<?php

namespace App\Models\Company;

use App\Models\System\Region;
use Illuminate\Database\Eloquent\Model;

class Task extends Model
{
    protected $table = 'company_upload_task';

    protected $fillable = [
        'author_id',
        'name',
        'path',
        'entry',
        'num',
        'time',
        'label_id',
        'is_top',
        'region_id'
    ];

    protected $casts = [
        'is_top' => 'boolean'
    ];

    public function archive()
    {
        return $this->hasMany(Archive::class, 'task_id', 'id');
    }

    public function region()
    {
        return $this->hasOne(Region::class, 'id', 'region_id');
    }
}
